<?php
	
	drupal_set_title('');
	$url = $config->getVar('url');
	
	drupal_add_js('misc/collapse.js');
	drupal_add_js('bdbdec/view/scripts/addUser.js.');
	drupal_add_js('bdbdec/view/scripts/JQueryValidate.js.');
	
	echo '
	<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">Ajouter un utilisateur</h2>
		<ul class="tabs primary">
			<li class="active">
				<a class="active" href="'.$url.'/bdbdec.php?action=addUser">Ajouter un utilisateur</a>
			</li>
			<li>';
			if ($user->getGrade()->getType() == GRADE_TYPE_POWER && $user->isAllowedTo(GRADE_ADD_MEMBER))
				echo '<a href="'.$url.'/bdbdec.php?action=editUserPerm">Modifier un utilisateur</a>';
			else if ($user->getGrade()->getType() == GRADE_TYPE_ADMIN)
				echo '<a href="'.$url.'/bdbdec.php?action=editUserAdmin">Modifier un utilisateur</a>';
			echo '   
			</li>
		</ul>
	</div>
	
	<form action="./bdbdec.php?action=addUser" accept-charset="UTF-8" method="post" id="add-user-form">
		<fieldset class="collapsible">
			<legend><a href="#">Remplissez le formulaire ci-dessous</a></legend>
		
			<div>
				<div class="form-item" id="edit-lastname-wrapper">
					<label for="edit-lastname">Nom: <span class="form-required" title="This field is required.">*</span></label>
					<input type="text" maxlength="20" name="lastname" id="edit-lastname" size="30" value="" class="form-text required" />
				</div>
				<div class="form-item" id="edit-firstname-wrapper">
					<label for="edit-firstname">Pr&eacute;nom: <span class="form-required" title="This field is required.">*</span></label>
					<input type="text" maxlength="20" name="firstname" id="edit-firstname" size="30" value="" class="form-text required" />
				</div>
				<div class="form-item" id="edit-email-wrapper">
					<label for="edit-email">Email: <span class="form-required" title="This field is required.">*</span></label>
					<input type="text" maxlength="30" name="email" id="edit-email" size="45" value="" class="form-text required" />
				</div>
				<div class="form-item" id="edit-semester-wrapper">
					<label for="edit-semester">Semestre: </label>
					<select name="semester" class="form-select" id="edit-semester" >
						<option value="1">TC01</option>
						<option value="2">TC02</option>
						<option value="3">TC03</option>
						<option value="4">TC04</option>
						<option value="5">TC06</option>
						<option value="11">GX01</option>
						<option value="12">GX02</option>
						<option value="13">GX03</option>
						<option value="14">GX04</option>
						<option value="15">GX05</option>
						<option value="16">GX06</option>
						<option value="17">GX07</option>
						<option value="18">GX09</option>
						<option value="20">Non UTC</option>
					</select>
				</div>
				<div class="form-item" id="edit-grade-wrapper">
					<label for="edit-grade">Grade: </label>
					<select name="grade" class="form-select" id="edit-grade" >';
					
						foreach (grade::getGradesByType(GRADE_TYPE_BASIC) as $grade)
						{
							echo '<option value="'.$grade['id'].'">'.$grade['name'].'</option>';
						}
					echo '
					</select>
				</div>
				<div class="form-item" id="edit-comment-wrapper">
					<label for="edit-comment">Commentaires: </label>
					<textarea cols="45" rows="3" name="comment" id="edit-comment" class="form-textarea resizable"></textarea>	
				</div>
				<div class="form-item" id="edit-paid-wrapper">
					<label class="option"><input type="checkbox" name="paid" id="edit-paid" value="1" class="form-checkbox" /> Paiement de la cotisation effectu&eacute;</label>
				</div>
				<div class="form-item" id="edit-deposit-wrapper">
					<label class="option"><input type="checkbox" name="deposit" id="edit-deposit" value="1" class="form-checkbox" /> Paiement de la caution effectu&eacute;</label>
				</div>
				<div class="form-item" id="edit-saverecords-wrapper">
					<label class="option"><input type="checkbox" name="saverecords" id="edit-saverecords" value="1" class="form-checkbox" /> Autoriser la BDBDEC &agrave; publier ces donn&eacute;es</label>
				</div>
				<input type="submit" name="op" id="edit-submit" value="Enregistrer"  class="form-submit" />
			</div>
		</fieldset>
	</form>';
?>